<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script src="../../vuejs/vue.js"></script>

<ul id="example-1">
    <li v-for="item in items" :key="item.message"><!-- 这个key有什么用呢？-->
        {{ item.message }}
    </li>
</ul>
<ul id="example-2">
    <li v-for="(item, index) in items">
        {{ parentMessage }} - {{ index }} - {{ item.message }}
    </li>
</ul>

<ul id="v-for-object" class="demo">
    <li v-for="value in object">
        {{ value }}
    </li>
</ul>

<div id="app">
    <div v-for="(value, name) in object">
        {{ name }}: {{ value }}
    </div>
</div>
<br>

<div id="app2">
    <div v-for="(value, name, index) in object">
        {{ index }}. {{ name }}: {{ value }}
    </div>
</div>
<script>
    var example1 = new Vue({
        el: '#example-1',
        data: {
            items: [
                {message: 'Foo'},
                {message: 'Bar'},
                {message: 'Bar'}
            ]
        }
    })
    var example2 = new Vue({
        el: '#example-2',
        data: {
            parentMessage: 'Parent',
            items: [
                { message: 'Foo' },
                { message: 'Bar' }
            ]
        }
    })

    new Vue({
        el: '#v-for-object',
        data: {
            object: {
                title: 'How to do lists in Vue',
                author: 'Jane Doe',
                publishedAt: '2016-04-10'
            }
        }
    })

    new Vue({
        el:"#app",
        data:{
            object:{
                title: "标题",
                author: "李依若",
                publishedAt: "2020-01-01"
            }
        }
    })

    new Vue({
        el:"#app2",
        data:{
            object:{
                title: "标题",
                author: "李依若",
                publishedAt: "2020-01-01"
            }
        }
    })
</script>
</body>
</html>